home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #14
/
Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO
/
math
/
maca_101.zip
/
ARRAYS.DEM
< prev
next >
Wrap
Text File
|
1996-01-30
|
2KB
|
102 lines
;ARRAYS.DEM
;DEMO FILE FOR MASSCALC VERSION 1.00
;WRITTEN BY: Ralph W. Reid
;This file may only be distributed in its unmodified form.
;
;DESCRIPTION: This file primarily demonstrates array creation and usage.
;
;For the latest releases of MASSCALC and other software created by
;Ralph W. Reid, see http://www2.athenon.com/~rreid/products/00-index.html.
;
;HOW TO USE THIS FILE: This file may be piped into MASSCALC, and its
;output displayed as follows:
;TYPE ARRAYS.DEM | MASSCALC | MORE
;This file may be redirected into MASSCALC and its output displayed
;as follows:
;MASSCALC < ARRAYS.DEM | MORE
;These two commands should be run from the operating system prompt.
;Create and display an array with four rows.
create array: A (4);
print: "Array A created and initialized to:"
A;
;Create and display an array with four columns.
create array: B (1, 4);
print:
print: "Array B created and initialized to:"
B;
;Assign values to both arrays and display the results.
A = 1, 2, 3, 4;
B = A;
print:
print: "Array A assigned values:"
A;
print:
print: "Array B assigned values:"
B;
;Multiply the two arrays together.
print:
print: "A * B:"
A * B;
;Create an array to hold the result.
create array: C (4, 4);
print:
print: "Array C initialized to:"
C;
;Assign C: A*B.
C = A * B;
print:
print: "Array C assigned:"
C;
;Display C + C.
print:
print: "C + C:"
C + C;
;Display some simple multiplications of C.
print:
print: "2 * C:"
2 * C;
print:
print: "3 * C:"
3 * C;
;Clean up some memory.
print: "User defined variables in memory:"
Show variables.
Delete all arrays.
print:
print: "All user defined variables have been removed."
;Create a six row and a six column array.
create array: sixrows [6];
create array: sixcols [1, 6];
sixrows = log_b (2, 2), log (100), floor (_pi), ceil (_pi),
2^2+1, floor (sin (_pi/2)) + 5;
sixcols = 6 * sixrows;
print:
print: "sixrows and sixcols arrays:"
sixrows;
sixcols;
;Create and display a 3 dimensional array.
create array: big array [log (100), _pi - 1, _pi];
print:
print: "big array info:"
Show array structure: big array;
print:
print: "big array initial values:"
big array;
;Assign some values to big array and display the result.
big array = sixrows, sixcols;
print: "big array assigned: sixrows, sixcols:"
big array;